package homework1121;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileCopy {

    public static void copy(FileReader src,FileWriter dest) throws IOException {
        src.transferTo(dest);
//        char[] buff = new char[5];
//        while((src.read(buff))!=-1){
//            dest.write(buff);
//            System.out.println("buff已满,写入数据");
//        }
    }

    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("homework1121/test/src.txt");
        FileWriter fw = new FileWriter("homework1121/test/target.txt");

        copy(fr,fw);

        fr.close();
        fw.close();
    }
}
